package com.googlecode.restitory.gae.filter.wrapper;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletResponseWrapper;

public class CodeResponseAdapter extends HttpServletResponseWrapper {

	private Integer status;

	public CodeResponseAdapter(HttpServletResponse response) {
		super(response);
	}

	@Override
	public void sendError(int sc) throws IOException {
		this.status = sc;
		super.sendError(sc);
	}

	@Override
	public void sendError(int sc, String msg) throws IOException {
		this.status = sc;
		super.sendError(sc, msg);
	}

	@Override
	public void setStatus(int sc) {
		this.status = sc;
		super.setStatus(sc);
	}

	@Override
	public void setStatus(int sc, String sm) {
		this.status = sc;
		super.setStatus(sc, sm);
	}

	public Integer getCode() {
		return status;
	}

}
